<?php
/**
 * Created by PhpStorm.
 * User: mac
 * Date: 16/9/12
 * Time: 下午1:27
 */


namespace app\app\controller;


use think\Controller;
use think\Request;

class System extends Controller
{

    public function autoUpdate(){
        $server_version = "2.0.0";
        $client_version = Request::instance()->post('version');

        $apk_url = "http://qiniu-app-cdn.pgyer.com/7d85ec5bc340b3226151fc3d2a58370d.apk?e=1473659087&attname=Sunshine_1_v1.6.000_release.apk&token=6fYeQ7_TVB5L0QSzosNFfw2HU8eJhAirMF5VxV9G:e9w725fbyT7w1R2tQhOLRWQah2o=";
        if (!$client_version){
            return 100;
        }
        if (version_compare($server_version,$client_version)>0){
            //需要更新
            $arr = array(
                "apk_url"   =>  $apk_url,
                "server_version" =>  $server_version,
                "info"      =>  "新版本来啦",
            );
            return $arr;
        }else{
            return 100;
        }
    }

}